package com.tanhua.sso.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    RedisTemplate redisTemplate;

    @RequestMapping("/login")
    public String login(String phone){

        redisTemplate.boundValueOps(phone).set("123456");
        System.out.println(phone);
        return null;
    }

    @RequestMapping("/loginVerification")
    public boolean loginVerification(String code){
        Object trueCode = redisTemplate.boundValueOps("17852054318").get();

        if(trueCode.equals(code)){
            return true;
        }
        return false;
    }
}
